﻿using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ebusiness_Framework.ResourcesMonitoring
{
    public class ResourcesMonitersAttribute : ActionFilterAttribute
    {
        public ResourcesMonitersAttribute()
        {

        }

        public override void OnActionExecuting(ActionExecutingContext context)
        {
            ResourcesMoniters service = context.HttpContext.RequestServices.GetRequiredService<ResourcesMoniters>();
            service.ResourcesCounter(context.HttpContext.Request.Method, context.HttpContext.Request.Path);
        }
    }
}
